pub fn convert_base(num_str: &str, to_base: u32) -> String {
	// todo!()
	let num_str_vec:Vec<&str> = num_str.split('(').collect();
	let base_num_str:&str = num_str_vec[0];
	let base_str_vec:Vec<&str> = num_str_vec[1].split(')').collect();
	let base:u32 = base_str_vec[0].parse().unwrap();
	let num = str2num(base_num_str, base);
	let result:String = num2str(num, to_base);
	return result;
}

fn str2num(num_str: &str, base: u32) -> u32 {
	let mut result:u32 = 0;
	let mut temp_base:u32 = 1;
	for c in num_str.chars().rev() {
		match c {
			'0' => result += temp_base * 0,
			'1' => result += temp_base * 1,
			'2' => result += temp_base * 2,
			'3' => result += temp_base * 3,
			'4' => result += temp_base * 4,
			'5' => result += temp_base * 5,
			'6' => result += temp_base * 6,
			'7' => result += temp_base * 7,
			'8' => result += temp_base * 8,
			'9' => result += temp_base * 9,
			'a' => result += temp_base * 10,
			'b' => result += temp_base * 11,
			'c' => result += temp_base * 12,
			'd' => result += temp_base * 13,
			'e' => result += temp_base * 14,
			'f' => result += temp_base * 15,
			_ => {}
		}

		temp_base *= base;
	}

	return result;
}

fn num2str(num: u32, to_base: u32) -> String {
	let mut result:String = String::new();
	let mut temp_num:u32 = num;
	while temp_num > 0 {
		let temp:u32 = temp_num % to_base;
		match temp {
			0 => result.insert(0, '0'),
			1 => result.insert(0, '1'),
			2 => result.insert(0, '2'),
			3 => result.insert(0, '3'),
			4 => result.insert(0, '4'),
			5 => result.insert(0, '5'),
			6 => result.insert(0, '6'),
			7 => result.insert(0, '7'),
			8 => result.insert(0, '8'),
			9 => result.insert(0, '9'),
			10 => result.insert(0, 'a'),
			11 => result.insert(0, 'b'),
			12 => result.insert(0, 'c'),
			13 => result.insert(0, 'd'),
			14 => result.insert(0, 'e'),
			15 => result.insert(0, 'f'),
			_ => {}
		}
		temp_num /= to_base;
	}

	return result;
}